﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ListaProduto.aspx.cs" Inherits="TVH.Cadastro.ListaProduto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
    <asp:HiddenField ID="hdnGridAction" runat="server" />
    <asp:HiddenField ID="hdnID" runat="server" />
    <asp:Label ID="lblMensagem" runat="server"></asp:Label>
    <div class="geral">
        <h1>
            Lista de Produtos</h1>
        <div class="filtro" style="height: 20px">
            <div class="float-left">
                <div class="fields">
                    <div class="field">
                        <label class="normal">
                            Descrição</label>
                        <asp:TextBox runat="server" ID="txtDescricao" class="input-size-100" />
                    </div>
                    <div class="field">
                        <label class="normal">
                            Categoria</label>
                        <asp:DropDownList runat="server" ID="ddlCategoria" class="input-size-100" AppendDataBoundItems="true">
                            <asp:ListItem Text="" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="field">
                        <asp:Button runat="server" ID="btnBuscar" Text="Buscar" CssClass="button" OnClick="btnBuscar_Click" />
                    </div>
                </div>
            </div>
            <div class="float-right">
                <a href="Produto.aspx" class="button botao-azul">Adicionar Produto</a>
            </div>
        </div>
        <asp:GridView runat="server" ID="gridResultado" AllowPaging="true" AutoGenerateColumns="false"
            CssClass="grid" BorderWidth="0" GridLines="None" DataKeyNames="ID" PagerSettings-Position="TopAndBottom"
            AlternatingRowStyle-CssClass="odd" EmptyDataText="Não há dados a serem exibidos."
            OnRowDataBound="gridResultado_RowDataBound" OnRowDeleting="gridResultado_RowDeleting"
            OnRowEditing="gridResultado_RowEditing" OnPageIndexChanging="gridResultado_PageIndexChanging"
            OnSelectedIndexChanging="gridResultado_SelectedIndexChanging">
            <PagerTemplate>
                <div class="pagination">
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                        CssClass="button"><<</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Page" CommandArgument="Prev"
                        CssClass="button"><</asp:LinkButton>
                    <span>Página
                        <%= gridResultado.PageIndex+1%>
                        de
                        <%= gridResultado.PageCount %></span>
                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                        CssClass="button">></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last"
                        CssClass="button">>></asp:LinkButton>
                </div>
            </PagerTemplate>
            <Columns>
                <asp:BoundField HeaderText="Descrição" DataField="Descricao" />
                <asp:BoundField HeaderText="Categoria" DataField="DescricaoCategoria" />
                <asp:BoundField HeaderText="Valor" DataField="Valor" DataFormatString="{0:c}" />
                <asp:BoundField HeaderText="Ordem de Exibição" DataField="Ordem" />
                <asp:TemplateField HeaderText="Detalhar" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkDetalhar" CommandArgument='<%# Eval("ID") %>' CommandName="Select"
                            runat="server">
                            <img alt="Detalhar" runat="server" id="imgDetalhar" src="~/img/ico-read.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Editar" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkEditar" CommandArgument='<%# Eval("ID") %>' CommandName="Edit"
                            runat="server">
                            <img alt="Editar" runat="server" id="imgEditar" src="~/img/ico-edit.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Excluir" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkExcluir" CommandArgument='<%# Eval("ID") %>' CommandName="Delete"
                            runat="server">
                            <img alt="Excluir" runat="server" id="imgExcluir" src="~/img/ico-delete.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</asp:Content>
